﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using Quartz;
namespace Quartz.net学习
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }

    public class SimpleQuartzJob : IJob
    {



        private static ILog _log = LogManager.GetLogger(typeof(SimpleQuartzJob));



        /// <summary> 
        /// Called by the <see cref="IScheduler" /> when a 
        /// <see cref="Trigger" /> fires that is associated with 
        /// the <see cref="IJob" />. 
        /// </summary> 
        public virtual void Execute(IJobExecutionContext context)
        {
            try
            {
                // This job simply prints out its job name and the 
                // date and time that it is running 
                string jobName = context.JobDetail.Key.Name;
                _log.Info("Executing job: " + jobName + " executing at " + DateTime.Now.ToString("r"));
            }
            catch (Exception e)
            {
                _log.Info("--- Error in job!");

                JobExecutionException e2 = new JobExecutionException(e);
                // this job will refire immediately 
                e2.RefireImmediately = true;
                throw e2;
            }

        }
    }

}
